package cn.jc.springframework.context.even;

import cn.jc.springframework.beans.factory.BeanFactory;
import cn.jc.springframework.context.ApplicationEvent;
import cn.jc.springframework.context.ApplicationListener;

/**
 * @Description:
 * @author: JC
 * @date: 2023/4/8 16:01
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster {

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }


    @SuppressWarnings("unchecked")
    @Override
    public void multicastEvent(ApplicationEvent event) {
        for(final ApplicationListener listener : getApplicationListeners(event)){
            listener.onApplicationEvent(event);
        }
    }
}
